<?php
namespace app\admin\controller;

use app\common\controller\Back;

class Login extends Back
{
    //密码登录界面
    public function index()
    {
        if( !is_file('./runtime/db/install.lock') ){
			$this->error('请先安装','share/install/index');
		}

        $this->assign($this->site);

        return $this->fetch();
    }
    
    //密码登录验证
    public function update()
    {
        $post = [];
        $post['user_name']     = input('post.user_name/s');
        $post['user_pass']     = input('post.user_pass/s');
        $post['captcha_image'] = input('post.captcha_image/s');
        //调用登录接口
        if(!model('common/User','loglic')->loginPassword($post)){
            $this->error(model('common/User','loglic')->getError());
        }
        //登录成功
        $this->success('ok','admin/index/index');
    }
}